package com.puboot.module.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.puboot.common.util.Pagination;
import com.puboot.module.admin.mapper.BizRotationImgMapper;
import com.puboot.module.admin.model.BizCategory;
import com.puboot.module.admin.model.BizContact;
import com.puboot.module.admin.model.BizRotationImg;
import com.puboot.module.admin.service.BizRotationService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@AllArgsConstructor
public class BizRotationImgServiceImpl extends ServiceImpl<BizRotationImgMapper, BizRotationImg> implements BizRotationService {

    private BizRotationImgMapper bizRotationImgMapper;

    @Override
    public IPage<BizRotationImg> bizRotationImgAll(BizRotationImg bizRotationImg, Integer pageNumber, Integer pageSize) {
        IPage<BizRotationImg> page = new Pagination<>(pageNumber, pageSize);
        return page.setRecords(bizRotationImgMapper.selectAll(page, bizRotationImg));
    }

    @Override
    public BizRotationImg selectById(Integer id) {
        return bizRotationImgMapper.getById(id);
    }

    @Override
    public List<BizRotationImg> getImageByStatus(Integer status) {
        QueryWrapper<BizRotationImg> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("status", status);
        queryWrapper.orderByAsc("sort_number");
        return baseMapper.selectList(queryWrapper);
    }
}
